//
//  RHDevParaModel.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2024/3/15.
//

#import "RHDevParaModel.h"

@implementation RHDevParaModel
+ (NSDictionary *)modelCustomPropertyMapper {
 return @{@"paramName" : @[@"paramName",@"cmdCode"],
          @"paramNickName" : @[@"paramNickName",@"cmdName"]};
 }

+ (NSDictionary *)modelContainerPropertyGenericClass {
  return @{@"thresholdParamConfigVos" : [RHDevParaModel class]};
 }

- (NSString *)thresholdName
{
    NSString *paramLanKey = [NSString localLanguageMapToParamLanguage];
    NSString *paramName =  self.paramLanguageDic[paramLanKey];
    if(paramName.length > 0){
        return paramName;
    }
    return _thresholdName;
}
-(NSString *)paramNickName
{
    NSString *paramLanKey = [NSString localLanguageMapToParamLanguage];
    NSString *paramName =  self.paramLanguageDic[paramLanKey];
    if(paramName.length > 0){
        return paramName;
    }
    return _paramNickName;
}

-(void)setI18n:(NSString *)i18n
{
    _paramLanguageDic = [i18n jsonStringToDictionary];
}

-(void)setEnumI18n:(NSString *)enumI18n
{
    _enumLanguageDic = [enumI18n jsonStringToDictionary];
}

-(void)setEnums:(NSString *)enums
{
    if([enums isKindOfClass:[NSString class]]&&enums.length>0){
        _enumArr = [enums componentsSeparatedByString:@","];
    }else{
        _enumArr = @[];
    }
}
-(void)setEnumNames:(NSString *)enumNames
{
    if([enumNames isKindOfClass:[NSString class]]&&enumNames.length>0){
        _enumNameArr = [enumNames componentsSeparatedByString:@","];
    }else{
        _enumNameArr = @[];
    }
}

- (NSArray *)enumNameArr
{
    NSString *lanKey = [NSString localLanguageMapToParamLanguage];
    if (self.enumLanguageDic[lanKey]) {
        NSString *enumString = self.enumLanguageDic[lanKey];
        if ([enumString isKindOfClass:[NSString class]]&&enumString.length>0) {
            return [enumString componentsSeparatedByString:@","];
        }
        return @[];
    }
    return _enumNameArr;
}

@end
